<!DOCTYPE html>
<html lang="zh-CN" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>实验室辅助管理系统</title>
    <link rel="stylesheet" th:href="@{/css/fontawesome-local.css}">
    <link th:href="@{/css/style.css}" rel="stylesheet">
    <style>
        /* 全局重置 */
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        html, body {
            height: 100%;
            font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
        }

        body {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            background-attachment: fixed;
            color: #333;
            overflow-x: hidden;
        }

        /* 页面容器 */
        .page-container {
            min-height: 100vh;
            display: flex;
            flex-direction: column;
        }

        /* 顶部导航栏 */
        .navbar {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-bottom: 1px solid rgba(255, 255, 255, 0.2);
            padding: 0;
            position: sticky;
            top: 0;
            z-index: 1000;
            box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
        }

        .navbar-content {
            max-width: 1400px;
            margin: 0 auto;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .brand {
            display: flex;
            align-items: center;
            gap: 12px;
            text-decoration: none;
            color: inherit;
        }

        .brand-icon {
            width: 40px;
            height: 40px;
            background: linear-gradient(135deg, #1a73e8, #4285f4);
            border-radius: 10px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 20px;
        }

        .brand-text {
            font-size: 24px;
            font-weight: 700;
            color: #1a73e8;
        }

        .user-section {
            display: flex;
            align-items: center;
            gap: 20px;
        }

        .user-info {
            display: flex;
            align-items: center;
            gap: 12px;
        }



        .user-details h4 {
            font-size: 16px;
            color: #333;
            margin-bottom: 2px;
        }

        .user-details p {
            font-size: 13px;
            color: #666;
        }

        .logout-btn {
            background: linear-gradient(135deg, #ea4335, #d33b2c);
            color: white;
            text-decoration: none;
            padding: 10px 20px;
            border-radius: 25px;
            font-weight: 500;
            transition: all 0.3s ease;
            display: flex;
            align-items: center;
            gap: 8px;
            border: none;
            cursor: pointer;
        }

        .logout-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(234, 67, 53, 0.3);
        }

        /* 主内容区域 */
        .main-container {
            flex: 1;
            display: flex;
            align-items: center;
            justify-content: center;
            padding: 40px 20px;
        }

        .content-box {
            width: 100%;
            max-width: 1000px;
            text-align: center;
        }

        /* 欢迎区域 */
        .welcome-area {
            margin-bottom: 50px;
        }

        .welcome-title {
            font-size: 48px;
            font-weight: 800;
            color: #333;
            margin-bottom: 16px;
            text-shadow: 0 2px 4px rgba(255, 255, 255, 0.8);
        }

        .welcome-subtitle {
            font-size: 20px;
            color: #555;
            font-weight: 400;
        }

        /* 功能卡片网格 */
        .features-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
            gap: 30px;
            margin-bottom: 50px;
        }

        .feature-card {
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            padding: 40px 30px;
            text-decoration: none;
            color: inherit;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            border: 1px solid rgba(255, 255, 255, 0.3);
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
            position: relative;
            overflow: hidden;
        }

        .feature-card::before {
            content: '';
            position: absolute;
            top: 0;
            left: 0;
            right: 0;
            height: 4px;
            background: linear-gradient(90deg, #1a73e8, #4285f4);
            transform: scaleX(0);
            transition: transform 0.3s ease;
        }

        .feature-card:hover {
            transform: translateY(-8px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
        }

        .feature-card:hover::before {
            transform: scaleX(1);
        }

        .feature-icon {
            width: 80px;
            height: 80px;
            margin: 0 auto 25px;
            background: linear-gradient(135deg, #1a73e8, #4285f4);
            border-radius: 20px;
            display: flex;
            align-items: center;
            justify-content: center;
            color: white;
            font-size: 36px;
        }

        .feature-title {
            font-size: 24px;
            font-weight: 700;
            color: #1a73e8;
            margin-bottom: 15px;
        }

        .feature-description {
            font-size: 16px;
            color: #666;
            line-height: 1.6;
            margin-bottom: 25px;
        }

        .feature-btn {
            background: linear-gradient(135deg, #1a73e8, #4285f4);
            color: white;
            border: none;
            padding: 12px 30px;
            border-radius: 25px;
            font-weight: 600;
            font-size: 16px;
            cursor: pointer;
            transition: all 0.3s ease;
            display: inline-flex;
            align-items: center;
            gap: 8px;
        }

        .feature-btn:hover {
            transform: translateY(-2px);
            box-shadow: 0 8px 25px rgba(26, 115, 232, 0.3);
        }

        /* 管理员功能区域 */
        .admin-section {
            background: rgba(255, 255, 255, 0.1);
            backdrop-filter: blur(20px);
            border-radius: 20px;
            padding: 40px;
            border: 1px solid rgba(255, 255, 255, 0.2);
        }

        .admin-title {
            font-size: 32px;
            font-weight: 700;
            color: white;
            margin-bottom: 30px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
        }

        .admin-grid {
            display: grid;
            grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
            gap: 20px;
        }

        .admin-card {
            background: rgba(255, 255, 255, 0.15);
            backdrop-filter: blur(10px);
            border: 1px solid rgba(255, 255, 255, 0.2);
            border-radius: 15px;
            padding: 25px 20px;
            text-decoration: none;
            color: white;
            transition: all 0.3s ease;
            text-align: center;
        }

        .admin-card:hover {
            background: rgba(255, 255, 255, 0.25);
            transform: translateY(-5px);
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
        }

        .admin-card i {
            font-size: 32px;
            margin-bottom: 15px;
            display: block;
        }

        .admin-card h3 {
            font-size: 16px;
            font-weight: 600;
            margin-bottom: 8px;
        }

        .admin-card p {
            font-size: 13px;
            opacity: 0.9;
            line-height: 1.4;
        }

        /* 底部 */
        .footer {
            background: rgba(0, 0, 0, 0.1);
            backdrop-filter: blur(20px);
            color: white;
            text-align: center;
            padding: 25px 20px;
            border-top: 1px solid rgba(255, 255, 255, 0.1);
        }

        .footer p {
            margin: 5px 0;
            font-size: 14px;
            opacity: 0.8;
        }

        /* 响应式设计 */
        @media (max-width: 768px) {
            .navbar-content {
                padding: 15px 20px;
                flex-direction: column;
                gap: 15px;
            }

            .welcome-title {
                font-size: 36px;
            }

            .welcome-subtitle {
                font-size: 18px;
            }

            .features-grid {
                grid-template-columns: 1fr;
                gap: 20px;
            }

            .admin-grid {
                grid-template-columns: repeat(2, 1fr);
            }

            .main-container {
                padding: 20px 15px;
            }
        }

        @media (max-width: 480px) {
            .admin-grid {
                grid-template-columns: 1fr;
            }

            .feature-card {
                padding: 30px 25px;
            }

            .welcome-title {
                font-size: 28px;
            }
        }

        /* 消息提示样式 */
        .message-container {
            position: fixed;
            top: 20px;
            right: 20px;
            z-index: 9999;
            max-width: 400px;
        }

        .message {
            background: white;
            border-radius: 8px;
            padding: 16px 20px;
            margin-bottom: 10px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12);
            border-left: 4px solid #67C23A;
            display: flex;
            align-items: center;
            gap: 12px;
            transform: translateX(100%);
            opacity: 0;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            animation: slideIn 0.3s ease-out forwards;
        }

        .message.success {
            border-left-color: #67C23A;
        }

        .message.error {
            border-left-color: #F56C6C;
        }

        .message.warning {
            border-left-color: #E6A23C;
        }

        .message.info {
            border-left-color: #409EFF;
        }

        .message-icon {
            font-size: 18px;
            flex-shrink: 0;
        }

        .message.success .message-icon {
            color: #67C23A;
        }

        .message.error .message-icon {
            color: #F56C6C;
        }

        .message.warning .message-icon {
            color: #E6A23C;
        }

        .message.info .message-icon {
            color: #409EFF;
        }

        .message-content {
            flex: 1;
            font-size: 14px;
            color: #303133;
            line-height: 1.4;
        }

        .message-close {
            font-size: 16px;
            color: #C0C4CC;
            cursor: pointer;
            flex-shrink: 0;
            transition: color 0.3s ease;
        }

        .message-close:hover {
            color: #909399;
        }

        @keyframes slideIn {
            from {
                transform: translateX(100%);
                opacity: 0;
            }
            to {
                transform: translateX(0);
                opacity: 1;
            }
        }

        @keyframes slideOut {
            from {
                transform: translateX(0);
                opacity: 1;
            }
            to {
                transform: translateX(100%);
                opacity: 0;
            }
        }

        .message.hiding {
            animation: slideOut 0.3s ease-in forwards;
        }
    </style>
</head>
<body>
    <!-- 消息提示容器 -->
    <div class="message-container" id="messageContainer"></div>

    <div class="page-container">
        <!-- 顶部导航栏 -->
        <nav class="navbar">
            <div class="navbar-content">
                <a href="#" class="brand">
                    <div class="brand-icon">
                        <i class="fas fa-flask"></i>
                    </div>
                    <div class="brand-text">实验室辅助管理系统</div>
                </a>
                
                <div class="user-section">
                    <div class="user-info">
                        <div class="user-details">
                            <h4 th:text="${currentUser.name}">实验室管理员</h4>
                            <p th:text="${currentUser.role.name() == 'ADMIN' ? '超级管理员' : '实验室管理员'}">实验室管理员</p>
                        </div>
                    </div>
                    <a th:href="@{/logout}" class="logout-btn">
                        <i class="fas fa-sign-out-alt"></i>
                        退出登录
                    </a>
                </div>
            </div>
        </nav>

        <!-- 主内容区域 -->
        <main class="main-container">
            <div class="content-box">
                <!-- 欢迎区域 -->
                <div class="welcome-area">
                    <h1 class="welcome-title">欢迎使用实验室安全检查系统</h1>
                    <p class="welcome-subtitle">保障实验室安全，提升管理效率</p>
                </div>

                <!-- 主要功能区域 -->
                <div class="features-grid">
                    <a th:href="@{/safety-check}" class="feature-card">
                        <div class="feature-icon">
                            <i class="fas fa-clipboard-check"></i>
                        </div>
                        <h2 class="feature-title">安全检查登记</h2>
                        <p class="feature-description">
                            进行日常实验室安全检查，记录各项安全指标，确保实验室环境安全可靠。
                        </p>
                        <button class="feature-btn">
                            开始检查
                            <i class="fas fa-arrow-right"></i>
                        </button>
                    </a>

                    <a th:href="@{/safety-records}" class="feature-card">
                        <div class="feature-icon">
                            <i class="fas fa-search"></i>
                        </div>
                        <h2 class="feature-title">检查记录查询</h2>
                        <p class="feature-description">
                            查看历史安全检查记录，统计分析安全状况，追踪问题处理进度。
                        </p>
                        <button class="feature-btn">
                            查看记录
                            <i class="fas fa-arrow-right"></i>
                        </button>
                    </a>
                </div>

                <!-- 管理员功能区域 -->
                <div th:if="${currentUser.role.name() == 'ADMIN'}" class="admin-section">
                    <h2 class="admin-title">管理员功能</h2>
                    <div class="admin-grid">
                        <a th:href="@{/dashboard}" class="admin-card">
                            <i class="fas fa-tachometer-alt"></i>
                            <h3>系统仪表盘</h3>
                            <p>查看系统总览和统计数据</p>
                        </a>
                        <a th:href="@{/college-management}" class="admin-card">
                            <i class="fas fa-university"></i>
                            <h3>学院管理</h3>
                            <p>管理学院信息和设置</p>
                        </a>
                        <a th:href="@{/term-management}" class="admin-card">
                            <i class="fas fa-calendar-alt"></i>
                            <h3>学期管理</h3>
                            <p>设置和管理学期信息</p>
                        </a>
                        <a th:href="@{/laboratory-management}" class="admin-card">
                            <i class="fas fa-microscope"></i>
                            <h3>实验室管理</h3>
                            <p>管理实验室基本信息</p>
                        </a>
                        <a th:href="@{/user-management}" class="admin-card">
                            <i class="fas fa-users"></i>
                            <h3>用户管理</h3>
                            <p>管理系统用户和权限</p>
                        </a>
                        <a th:href="@{/assignment-management}" class="admin-card">
                            <i class="fas fa-user-cog"></i>
                            <h3>管理员分配</h3>
                            <p>分配实验室管理员</p>
                        </a>
                    </div>
                </div>
            </div>
        </main>

        <!-- 底部 -->
        <footer class="footer">
            <p>实验室辅助管理系统 © 2024 版权所有</p>
            <p>技术支持: 信息中心 | 联系电话: 123-4567890</p>
        </footer>
    </div>

    <script th:src="@{/js/app.js}"></script>
    <script>
        // 消息提示功能
        function showMessage(message, type = 'success', duration = 3000) {
            const container = document.getElementById('messageContainer');
            const messageEl = document.createElement('div');
            messageEl.className = `message ${type}`;
            
            let iconClass = '';
            switch (type) {
                case 'success':
                    iconClass = 'fas fa-check-circle';
                    break;
                case 'error':
                    iconClass = 'fas fa-times-circle';
                    break;
                case 'warning':
                    iconClass = 'fas fa-exclamation-triangle';
                    break;
                case 'info':
                    iconClass = 'fas fa-info-circle';
                    break;
                default:
                    iconClass = 'fas fa-check-circle';
            }
            
            messageEl.innerHTML = `
                <i class="message-icon ${iconClass}"></i>
                <div class="message-content">${message}</div>
                <i class="message-close fas fa-times"></i>
            `;
            
            container.appendChild(messageEl);
            
            // 点击关闭按钮
            messageEl.querySelector('.message-close').addEventListener('click', function() {
                hideMessage(messageEl);
            });
            
            // 自动关闭
            if (duration > 0) {
                setTimeout(() => {
                    hideMessage(messageEl);
                }, duration);
            }
        }
        
        function hideMessage(messageEl) {
            messageEl.classList.add('hiding');
            setTimeout(() => {
                if (messageEl.parentNode) {
                    messageEl.parentNode.removeChild(messageEl);
                }
            }, 300);
        }
        
        // 检查URL参数显示登录成功消息
        document.addEventListener('DOMContentLoaded', function() {
            const urlParams = new URLSearchParams(window.location.search);
            if (urlParams.get('loginSuccess')) {
                showMessage('登录成功！欢迎使用实验室辅助管理系统', 'success', 4000);
                // 清除URL参数
                const newUrl = window.location.pathname;
                window.history.replaceState({}, document.title, newUrl);
            }
        });
    </script>
</body>
</html>